package com.qwc.blog.entity.vo.category;

import com.qwc.blog.common.validate.IdValid;
import com.qwc.blog.entity.Category;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * @author qwc
 * @Date 2021/10/29 16:53
 */
@Data
public class CategoryDto {
    @NotNull(groups = IdValid.class, message = "分类主键不能为空")
    private Integer categoryId;
    @NotBlank(message = "分类名称不能为空")
    private String name;
    @NotNull(message = "显示顺序不能为空")
    private Integer sort;
    private Integer pid;
    private String status;
    private String individual;

    public Category createCategory() {
        Category category = new Category();
        category.setCategoryId(categoryId);
        category.setName(name);
        category.setSort(sort);
        category.setPid(pid);
        category.setStatus(status);
        category.setIndividual(individual);
        return category;
    }
}
